<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" onkeyup="myOnKeyUp()">
</body>
<script>
    let input = document.querySelector("input")
    input.onkeypress = function(event){
        // console.log("用户正在输入")
        // let a = event.keyCode
       
        // let b = String.fromCharCode(a)
        // console.log(b)
        if(event.shiftKey){
            alert("shift键被按下")
        }
        if(event.AltKey){
            alert("shift键被按下")
        }

    }
    function myOnKeyUp(){
        console.log("按键被抬起")
    }
</script>
</html>